<template>
  <div>
    <audio src="../assets/结束语.mp3" autoplay></audio>
    <div class="jieshu">考试结束</div>
    <el-card class="box-card" v-for="(item,index) in queryAnswerList" :key="index">
      <div style="font-weight: 700; margin-bottom: 15px;">答案</div>
      <div class="qwer">
        <div class="clearfix">
          <span style="font-weight: 700;">题目名称: {{ item.question }}</span>
        </div>
        <div class="text item">
          解析：<span>{{ item.content }}</span>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import { queryAnswer } from '@/api';
import { mapState, mapGetters } from 'vuex';
export default {
  data() {
    return {
      // data:[]
      queryAnswerList: [],
    };
  },
  mounted() {
    // console.log(this.data);
    // this.$store.state.data = this.data
    // console.log(this.data);
    this.answerList();
  },
  methods: {
    answerList() {
      let id = [];
      this.data.forEach((item) => {
        id.push(item.id);
      });
      queryAnswer(id).then((res) => {
        console.log(res);
        this.queryAnswerList = res.data.data;
      });
    },
  },
  computed: {
    ...mapState(['data']),
  },
};
</script>

<style scoped>
.jieshu {
  margin: 20px auto;
  height: 100px;
  width: 100px;
  font-size: 50px;
}
.text {
  font-size: 18px;
}

.item {
  margin-bottom: 18px;
  margin-top: 10px;
}

.box-card {
  width: 700px;
  margin: 50px auto;
}
.qwer {
  margin-left: 20px;
}
</style>